import serve from './../Base/Http.js'
import qs from 'qs'
// 数据列表
export default {
    discount(allPages) {
        // console.log(allPages)
        return serve({
            method: 'get',
            params: {
                _gp: "admin.advertisement",
                _mt: "queryAdvertisement",
               //分页
                adType:allPages.adType,
                statu:allPages.statu,
                pageNo: allPages.currentPage,
                limit: allPages.eachpage
            }
        })
    },
    // sup树
    spuTitles() {
        return serve({
            method: 'get',
            params: {
                _gp: "admin.goods",
                _mt: "getSpuBigTree",
            }
        })
    },
    //编辑
    compile(ruleForm,imageUrl,cascade) {
        console.log(cascade);
        
        return serve({
            method: 'post',
            data: qs.stringify({
                _gp: "admin.advertisement",
                _mt: "updateAdvertisement",
                title:ruleForm.title,
                // url:'/pages/product/list?tid=1036526' ,
                url:cascade,
                imgUrl :imageUrl,
                status:ruleForm.status ,
                color:'rgb(255 ,245, 238)',
                adId:ruleForm.id,
                adType:ruleForm.adType
            })
        })
    },

    // 添加
    addition(ruleForm,imageUrl) {
        return serve({
            method: 'post',
            data: qs.stringify({
                _gp: "admin.advertisement",
                _mt: "addAdvertisement",
                title:ruleForm.title,
                url :'/pages/product/list?tid=1036526',
                // url:ruleForm.url,
                imgUrl:imageUrl,
                status:ruleForm.status, 
                color:'rgb(255 ,245, 238)',
                adType:ruleForm.adType
            })
        })
    },
    // //删除
    handleDeletec(data) {
        console.log(data)
        return serve({
            method: 'post',
            data: qs.stringify(
                {
                    _gp: "admin.advertisement",
                    _mt: "deleteAdvertisement",
                    ...data
                }
            )
        })
    },
}